﻿/*
 * Created by SharpDevelop.
 * User: IEscarro
 * Date: 8/25/2009
 * Time: 3:21 PM
 * 
 * To change this template use Tools | Options | Coding | Edit Standard Headers.
 */

using System;
using System.Drawing;
using System.Windows.Forms;
using System.Collections.Generic;
using Miming.Model;

namespace Miming.Gui
{
	/// <summary>
	/// Description of CustomerMessageForm.
	/// </summary>
	public partial class CustomerMessageForm : BaseForm
	{
		public CustomerMessageForm() : this(new CustomerMessage())
		{
			
		}
		
		public CustomerMessageForm(CustomerMessage m)
		{
			//
			// The InitializeComponent() call is required for Windows Forms designer support.
			//
			InitializeComponent();
			Model = m;
		}
		
		protected override void OnModelChanged(EventArgs e)
		{
			base.OnModelChanged(e);
			CustomerMessage m = Model as CustomerMessage;
			richTextBoxMessage.Text = m.Message;
			checkBoxInactive.Checked = m.Inactive;
		}
		
		void ButtonOkClick(object sender, EventArgs e)
		{
			CustomerMessage m = Model as CustomerMessage;
			m.Message = richTextBoxMessage.Text;
			m.Inactive = checkBoxInactive.Checked;
			SessionFacade.SaveOrUpdateCustomerMessage(m);
			Close();
		}
		
		void ButtonCancelClick(object sender, EventArgs e)
		{
			Close();
		}
	}
}
